How-to implement the HTML renderer in your application

You might be interested by presenting your data using an HTML document.
You can even present your data using an DOM (understand XML based) document.

In that case, please follow this guideline

Requirements


Step-by-step tutorial

  1. Get a copy of UZI's subversion repository from here.
    If you don't know about subversion, then please help yourself by learning the basics about shared source.
  2. You'll find all required code in include and src subfolder of the repository
  3. Copy all the sources from above mentioned folders in your project, keeping the hierarchical directory structure (you can export it with SVN, if you don't intend to modify those sources)
  4. In the component MyComponent where you want to render an HTML content, add a member of type:
       juce::BrowserContent browserContent;
  5. Add an include to include/GUI/components/BrowserContent.hpp in the MyComponent.hpp header file
  6. In MyComponent::MyComponent constructor, construct the BrowserContent like this:
       browserContent = new BrowserContent(JUCE_T("../path/to/file.htm");
       addAndMakeVisible(browserContent);
    
  7. In MyComponent::resized() callback, add:
       int width = getWidth(); int height = getHeight();
       // Simple child component resizing
       browserContent->setSize(width, height);
       // Just make sure the renderer can fit the renderer data, if not, grow us a little bit 
       // You might simply not need this, so remove the 2 lines below
       if (height = browserContent->requiredHeightAfterRendering() > getHeight())
       	setSize(width, height);
    
  8. Compile, link and run, and enjoy the HTML rendering where MyComponent is displayed

Remarks

From the tutorial above, you'll soon see that not using a viewport can lead to extremly long windows.
It might be enough for your typical usage, but in case it isn't, please have a look to src/GUI/components/BrowserComponent.cpp for an implementation with viewports

If the HTML source is in memory, then please have a look to src/GUI/components/BrowserContent.cpp for an example implementation.





(C) An X-Ryl669 project 2007

This document describes Unlimited Zooming Interface source code. UZI stands for Unlimited Zooming Interface, and source code license is